package com.ruoyi.web.controller.monitor;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.monitor.domain.BusWaterIntegrationevaluatedataYear;
import com.ruoyi.monitor.service.IBusWaterIntegrationevaluatedataYearService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 手工评价（年）Controller
 * 
 * @author maliang
 * @date 2025-08-16
 */
@RestController
@RequestMapping("/monitor/integrationevaluatedatayear")
public class BusWaterIntegrationevaluatedataYearController extends BaseController
{
    @Autowired
    private IBusWaterIntegrationevaluatedataYearService busWaterIntegrationevaluatedataYearService;

    /**
     * 查询手工评价（年）列表
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedatayear:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterIntegrationevaluatedataYear busWaterIntegrationevaluatedataYear)
    {
        startPage();
        List<BusWaterIntegrationevaluatedataYear> list = busWaterIntegrationevaluatedataYearService.selectBusWaterIntegrationevaluatedataYearList(busWaterIntegrationevaluatedataYear);
        return getDataTable(list);
    }

    /**
     * 导出手工评价（年）列表
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedatayear:export')")
    @Log(title = "手工评价（年）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterIntegrationevaluatedataYear busWaterIntegrationevaluatedataYear)
    {
        List<BusWaterIntegrationevaluatedataYear> list = busWaterIntegrationevaluatedataYearService.selectBusWaterIntegrationevaluatedataYearList(busWaterIntegrationevaluatedataYear);
        ExcelUtil<BusWaterIntegrationevaluatedataYear> util = new ExcelUtil<BusWaterIntegrationevaluatedataYear>(BusWaterIntegrationevaluatedataYear.class);
        util.exportExcel(response, list, "手工评价（年）数据");
    }

    /**
     * 获取手工评价（年）详细信息
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedatayear:query')")
    @GetMapping(value = "/{reportid}")
    public AjaxResult getInfo(@PathVariable("reportid") String reportid)
    {
        return success(busWaterIntegrationevaluatedataYearService.selectBusWaterIntegrationevaluatedataYearByReportid(reportid));
    }

    /**
     * 新增手工评价（年）
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedatayear:add')")
    @Log(title = "手工评价（年）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusWaterIntegrationevaluatedataYear busWaterIntegrationevaluatedataYear)
    {
        return toAjax(busWaterIntegrationevaluatedataYearService.insertBusWaterIntegrationevaluatedataYear(busWaterIntegrationevaluatedataYear));
    }

    /**
     * 修改手工评价（年）
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedatayear:edit')")
    @Log(title = "手工评价（年）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusWaterIntegrationevaluatedataYear busWaterIntegrationevaluatedataYear)
    {
        return toAjax(busWaterIntegrationevaluatedataYearService.updateBusWaterIntegrationevaluatedataYear(busWaterIntegrationevaluatedataYear));
    }

    /**
     * 删除手工评价（年）
     */
    //@PreAuthorize("@ss.hasPermi('monitor:integrationevaluatedatayear:remove')")
    @Log(title = "手工评价（年）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reportids}")
    public AjaxResult remove(@PathVariable String[] reportids)
    {
        return toAjax(busWaterIntegrationevaluatedataYearService.deleteBusWaterIntegrationevaluatedataYearByReportids(reportids));
    }

    /**
     * 水质分类分布
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/qualityLevelStatis")
    public AjaxResult qualityLevelStatis(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterIntegrationevaluatedataYearService.qualityLevelStatis(id,startTime,endTime));
    }
    /**
     * 水质分布情况
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/statisItemCount")
    public AjaxResult statisItemCount(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterIntegrationevaluatedataYearService.statisItemCount(id,startTime,endTime));
    }

    /**
     * 水质变化趋势
     * @param id
     * @param startTime
     * @param endTime
     * @param items
     * @return
     */
    @GetMapping("/trendStatis")
    public AjaxResult trendStatis(String id,String startTime,String endTime,String items){
        return AjaxResult.success(busWaterIntegrationevaluatedataYearService.trendStatis(id,startTime,endTime,items));
    }

    /**
     * 水质级别趋势
     * @param id
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/trendQuality")
    public AjaxResult trendQuality(String id,String startTime,String endTime){
        return AjaxResult.success(busWaterIntegrationevaluatedataYearService.trendQuality(id,startTime,endTime));
    }

    /**
     * 优三劣五总结
     * @param ids
     * @param startTime
     * @param endTime
     * @param controlLevelCode
     * @return
     */
    @GetMapping("/excellentThreeInferiorFiveSum")
    public AjaxResult excellentThreeInferiorFiveSum(String ids,String startTime,String endTime,String controlLevelCode){

        return AjaxResult.success(busWaterIntegrationevaluatedataYearService.excellentThreeInferiorFiveSum(ids,startTime,endTime,controlLevelCode));
    }
}
